module Shrink
require "open-uri"
require "rexml/document"
include REXML
	def find(regid)
		xml =  open("http://mukti09.in/admin/regn.xml")
		doc = Document.new xml
		#list = Hash.new
		# XPath.each( doc, "//data") { |element| list[XPath.first(element,"regnid/text()").value()] = XPath.first(element,"email/text()") }
		regnid = []
		email = []
		XPath.each( doc, "//regnid/text()") { |element| regnid << element.value }
		XPath.each( doc, "//email/text()") { |element| email << element.value }
		index = regnid.index(regid)
		if !index.nil?
			return email[index]
		end
		return ""
	end	
end
